@echo off
REM SchedulerAI Docker Image Build Script for Windows

setlocal enabledelayedexpansion

REM Configuration
set IMAGE_NAME=scheduler-ai
set IMAGE_TAG=%1
if "%IMAGE_TAG%"=="" set IMAGE_TAG=latest

echo Building SchedulerAI Docker Image
echo ==================================
echo Image: %IMAGE_NAME%:%IMAGE_TAG%
echo.

REM Change to project root directory
cd /d "%~dp0\.."

REM Build the Docker image
echo Starting Docker build...
docker build ^
    -t "%IMAGE_NAME%:%IMAGE_TAG%" ^
    -f "Dockerfile" ^
    --build-arg BUILD_DATE="%date% %time%" ^
    --build-arg VERSION="%IMAGE_TAG%" ^
    .

if %ERRORLEVEL% neq 0 (
    echo Build failed!
    exit /b 1
)

echo.
echo Build completed successfully!
echo Image: %IMAGE_NAME%:%IMAGE_TAG%

REM Display image information
echo.
echo Image Information:
echo ==================
docker images "%IMAGE_NAME%:%IMAGE_TAG%"

echo.
echo To run the container:
echo docker run -p 8000:8000 %IMAGE_NAME%:%IMAGE_TAG%
echo.
echo To run with docker-compose:
echo docker-compose up -d

endlocal